<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="/static/css/reset.css">
    <link rel="stylesheet" href="/static/css/index.css">
    <style>
        html,
        body {
            width: 100%;
            height: 100%
        }

        .fr {
            float: right;
        }

        .w100 {
            width: 100%;
        }

        .h100 {
            height: 100%;
        }

        .bc {
            background-color: rgb(84, 92, 100);
        }

        .el-header {
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="app">

        <el-row>
            <!-- <el-button type="primary" @click="showDialog">添加店铺</el-button> -->
            <el-button type="primary" @click="shopAddUrl">添加店铺</el-button>
        </el-row>
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="所有店铺" name="first">
                <el-table :data="tableData" style="width: 100%" max-height="600">
  
                    <el-table-column prop="name" label="签约日期" width="100">
                    </el-table-column>
                    <el-table-column prop="name" label="店铺名称" width="100">
                    </el-table-column>
                    <el-table-column prop="platform" label="合作平台" width="150">
                    </el-table-column>
                    <el-table-column prop="address" label="运营" width="100">
                    </el-table-column>
                    <el-table-column prop="head_id" label="市场" width="100">
                    </el-table-column>
                    <el-table-column prop="service_id" label="美工" width="100">
                    </el-table-column>
                    <el-table-column prop="service_id" label="客服" width="100">
                    </el-table-column>
                    <el-table-column prop="style" label="状态" width="100">
                    </el-table-column>
                    
                    <el-table-column prop="content" label="服务时间">
                    </el-table-column>
                    <el-table-column fixed="right" label="操作">
                        <template slot-scope="scope">
                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData4)" type="text" size="small">
                                编辑
                            </el-button>
                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData4)" type="text" size="small">
                                移除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
        </el-tabs>
        <!-- <el-dialog title="添加店铺" :visible.sync="dialogFormVisible">
            <el-form :model="form">
                <el-form-item label="店名" :label-width="formLabelWidth">
                    <el-input v-model="form.name" auto-complete="off"></el-input>
                </el-form-item>
                <el-form-item label="平台" :label-width="formLabelWidth">
                    <el-input v-model="form.platform" auto-complete="off"></el-input>
                </el-form-item>
                <el-form-item label="地址" :label-width="formLabelWidth">
                    <el-input v-model="form.address" auto-complete="off"></el-input>
                </el-form-item>
                <el-form-item label="负责人" :label-width="formLabelWidth">
                    <el-select v-model="form.head_id" placeholder="负责人">
                        <el-option label="茅开彬" value="11"></el-option>
                        <el-option label="康昌铭" value="12"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="客服" :label-width="formLabelWidth">
                    <el-select v-model="form.service_id" placeholder="负责人">
                        <el-option label="茅开彬" value="11"></el-option>
                        <el-option label="康昌铭" value="12"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="备注" :label-width="formLabelWidth">
                    <el-input type="textarea" v-model="form.content"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addShop">确 定</el-button>
            </div>
        </el-dialog> -->
    </div>

</body>
<script src="/static/js/dbkj.js"></script>
<script src="/static/js/vue.js"></script>
<!-- 引入组件库 -->
<script src="/static/js/index.js"></script>
<script src="/static/js/axios.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        mounted() {
            this.loadData();
        },
        data() {
            return {
                activeName: 'first',
                form: {
                    name: "",
                    platform: "",
                    address: "",
                    head_id: "",
                    service_id: "",
                    style: "",
                    content: ""
                },
                tableData: [{
                    name: '1',
                    platform: '王小虎',
                    address: '上海',
                    head_id: "会员",
                    service_id: '一个小会员',
                    style: "182.123.123.123",
                    content: "1233"
                }],
                dialogFormVisible: false,
                formLabelWidth: '120px',
                dialogImageUrl: '',
                dialogVisible: false
            }
        },
        methods: {
            loadData() {
                this.getShop();
            },
            showDialog() {
                this.dialogFormVisible = !this.dialogFormVisible;
            },
            // 切换事件
            handleClick() {

            },
            handleRemove(file, fileList) {
                console.log(file, fileList);
            },
            handlePictureCardPreview(file) {
                this.dialogImageUrl = file.url;
                this.dialogVisible = true;
            },
            //获取管理员
            getShop() {
                let _this = this;
                axios.get('get_shop')
                    .then(res => {
                        console.log(res);
                        _this.tableData = res.data;
                    })
                    .catch(err => {

                    })
            },
            //添加店铺
            addShop() {
                let data = this.form;
                let _this = this;
                axios.post('add_shop', data)
                    .then(res => {
                        _this.dialogVisible = true;
                        _this.$message({
                            message: res.data.msg,
                            type: 'success'
                        });
                        _this.dialogVisible = false;
                    })
                    .catch(err => {
                        _this.$message({
                            message: err.data.msg,
                            type: 'error'
                        });
                    })
            },
            //店铺添加跳转
            shopAddUrl(){
                window.location.href = "/shop_add";
            }
        }
    })
</script>

</html>